<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>New VQ</title>
        <link rel="shortcut icon" href="../../img/icon.jpg">

        <script src="https://unpkg.com/vue@3"></script>
        <!-- import CSS -->
        <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
        <!--图标-->
        <script src="//unpkg.com/@element-plus/icons-vue"></script>
        <!-- import JavaScript -->
        <script src="https://unpkg.com/element-plus"></script>

        <script src="../../res_js/axios-0.18.0.js"></script>
        <script src="../../res_js/jquery-3.7.0.min.js"></script>

        <link rel="stylesheet" href="../../index.css">
        <link rel="stylesheet" href="../index.css">
        <link rel="stylesheet" href="./index.css">
        <script src="../../index.js"></script>
        <script src="../index.js"></script>
    </head>
    <body style="margin: 0;overflow: hidden">
        <div id="app">
            <!--主体-->
            <el-container>
                <!--标题栏-->
                <el-header>
                    <el-menu class="el-menu-demo"
                             :default-active="activeIndex"
                             mode="horizontal"
                             :ellipsis="false"
                             @select="handleSelect">
                        <el-menu-item style="font-size: 30px">New VQ</el-menu-item>
                        <el-menu-item index="1" onclick="window.location.href='/PC/home/index.html'">主页</el-menu-item>
                        <el-menu-item index="2" onclick="window.location.href='/PC/friend/index.html'">好友</el-menu-item>
                        <el-menu-item index="3" onclick="window.location.href='/PC/sala/index.html'">大厅</el-menu-item>
                        <div class="flex-grow"></div>
                        <el-menu-item index="4" onclick="window.location.href='/PC/search/index.html'">
                            <el-icon><Search></Search></el-icon>搜素&ensp;
                        </el-menu-item>
                        <el-menu-item index="5" onclick="window.location.href='/PC/userCenter/index.html'">用户中心</el-menu-item>
                        <el-sub-menu index="6">
                            <template #title><el-avatar src="/img/HeadSculpture.jpg" fit="cover"></el-avatar>&emsp;{{myUser.username}}</template>
                            <el-menu-item index="6-0">消息中心</el-menu-item>
                            <el-menu-item index="6-1">修改头像</el-menu-item>
                            <el-menu-item index="6-2">修改名称</el-menu-item>
                            <el-menu-item index="6-3">修改密码</el-menu-item>
                            <el-menu-item index="6-4"><el-link href="https://wwp.lanzoup.com/iEC150pka3la" target="_blank">下载客户端</el-link></el-menu-item>
                            <el-menu-item index="6-5" @click="exitAccount">退出账号</el-menu-item>
                        </el-sub-menu>
                    </el-menu>
                </el-header>
                <!--内容-->
                <el-main class="main" style="overflow: auto">
                    <div style="width: 14%; margin: 2% 3% 2% 3%; float: left">
                        <el-card style="margin-bottom: 10%; border-radius: 10px;" class="box-card" shadow="hover">
                            <table style="width: 100%">
                                <tr>
                                    <td>{{this.hCommunity.name}}</td>
                                </tr>
                                <tr>
                                    <td>关注人数：{{this.hCommunity.numberFollowers}}</td>
                                </tr>
                                <tr><td colspan="2"><el-button type="primary" @click="addCommunityMember(this.hCommunity.id)">加入</el-button></td></tr>
                            </table>
                        </el-card>
                        <el-card style="width: 100%; height: 60%; border-radius: 10px;" class="box-card" shadow="hover"><el-empty description="广告位" /></el-card>
                    </div>
                    <!--动态-->
                    <div id="trends" style="width: 59%; margin-top: 2%; margin-bottom: 2%; float: left"
                         v-infinite-scroll="selectTrends" infinite-scroll-distance="1">
                        <el-card v-for="trend in communityTrends"
                                 style="width: 80%; margin-left: 10%; margin-top: 2%; margin-bottom: 1%"
                                 class="box-card" shadow="hover">
                            <!--标头-->
                            <template #header>
                                <div slot="header" class="clearfix" @click="this.hTrend=trend; userInformationDialog=true">
                                    <el-avatar src="/img/HeadSculpture.jpg" style="margin-top: auto; float: left;">{{trend.username}}</el-avatar>
                                    <el-link style="margin-left: 1%;float: left;" :underline="false">{{trend.username}}</el-link>
                                    <el-button style="margin-left: auto; float: right; padding: 3px 0; color: red;" type="text"><a style="color: darkgray;">{{trend.time}}</a>&emsp;举报</el-button>
                                </div>
                            </template>
                            <!--内容-->
                            <el-tooltip class="box-item" effect="dark" content="查看更多" placement="bottom">
                                <el-card @click="open('/PC/trends/index.html?id='+trend.id)" style="text-align: left;line-height: 1;height: 6vh" shadow="never" class="box-card">
                                    <span style="margin-bottom: 1%" v-html="trend.title"></span>
                                    <span v-if="trend.title===null||trend.title===''" v-html="trend.content.substr(0,100)"></span>
                                </el-card>
                            </el-tooltip>
                            <!--标签功能-->
                            <div style="margin-top: 1%">
                                <!--标签-->
                                <el-form style="float: left; width: 50%"><el-form-item>
                                    <div v-for="tag in trend.comTags">
                                        <el-tag @click="selectCommunity(tag);communityInformationDialog=true">{{tag}}</el-tag>&ensp;
                                    </div>
                                </el-form-item></el-form>
                                <!--功能-->
                                <div style="margin-bottom: 1%; float: right; font-size: 50%;">
                                    <el-button size="medium" type="danger" @click="like(trend)" circle><el-icon><Pointer></Pointer></el-icon></el-button>&emsp;{{trend.likesNum}}&emsp;
                                    <el-button size="medium" type="warning" @click="collect(trend)" circle><el-icon><Star></Star></el-icon></el-button>&emsp;{{trend.collectNum}}&emsp;
                                    <el-button size="medium" type="primary" @click="this.critique.trendsId=trend.id; critiqueDialog=true" circle><el-icon><chat-dot-square></chat-dot-square></el-icon></el-button>&emsp;{{trend.critiqueNum}}&emsp;
                                </div>
                            </div>
                        </el-card>
                    </div>
                    <!--聊天区-->
                    <el-card style="width: 14%; margin: 2% 3% 2% 3%; float: left; border-radius: 10px;"
                             class="box-card" shadow="hover">
                        聊天区...
                    </el-card>
                </el-main>
            </el-container>

            <!--登录注册-->
            <el-dialog title="登陆注册"
                       v-model="logInDialog"
                       width="30%"
                       :before-close="handleClose"
                       align-center
                       center>
                <el-tabs v-model="activeName" @tab-click="handleClick">
                    <!--登录-->
                    <el-tab-pane label="登录" name="1">
                        <el-form ref="form" :model="logInForm" label-width="80px">
                            <el-form-item label="账号">
                                <el-input v-model="logInForm.account"></el-input>
                            </el-form-item>
                            <el-form-item label="密码">
                                <el-input type="password" v-model="logInForm.password"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="logIn">登 录</el-button>
                                <el-button @click="logInDialog = false">取 消</el-button>
                            </el-form-item>
                        </el-form>
                    </el-tab-pane>
                    <!--注册-->
                    <el-tab-pane label="注册" name="2">
                        <el-form ref="form" :model="registerForm" label-width="80px">
                            <el-form-item label="电子邮箱">
                                <el-input v-model="registerForm.email"></el-input>
                            </el-form-item>
                            <el-form-item label="验证码">
                                <el-input style="width: 70%" v-model="registerForm.captcha"></el-input>
                                <el-button style="width: 25%; margin-left: 5%" type="primary" :disabled="sendCaptchaBtnDis"  @click="sendCaptcha('register', registerForm.email)" round>{{sendCaptchaBtnValue}}</el-button>
                            </el-form-item>
                            <el-form-item label="用户名">
                                <el-input v-model="registerForm.username"></el-input>
                            </el-form-item>
                            <el-form-item label="密码">
                                <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="registerForm.password1"></el-input>
                            </el-form-item>
                            <el-form-item label="确认密码">
                                <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="registerForm.password2"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="register">注 册</el-button>
                                <el-button @click="logInDialog = false">取 消</el-button>
                            </el-form-item>
                        </el-form>
                    </el-tab-pane>
                    <!--忘记密码-->
                    <el-tab-pane label="忘记密码" name="3">
                        <el-form ref="form" :model="forgotPasswordForm" label-width="80px">
                            <el-form-item label="电子邮箱">
                                <el-input v-model="forgotPasswordForm.email"></el-input>
                            </el-form-item>
                            <el-form-item label="验证码">
                                <el-input style="width: 70%" v-model="forgotPasswordForm.captcha"></el-input>
                                <el-button style="width: 25%; margin-left: 5%" type="primary" :disabled="sendCaptchaBtnDis"  @click="sendCaptcha('forgotPassword', forgotPasswordForm.email)" round>{{sendCaptchaBtnValue}}</el-button>
                            </el-form-item>
                            <el-form-item label="密码">
                                <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="forgotPasswordForm.password1"></el-input>
                            </el-form-item>
                            <el-form-item label="确认密码">
                                <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="forgotPasswordForm.password2"></el-input>
                            </el-form-item>
                            <el-form-item>
                                <el-button type="primary" @click="forgotPassword()">忘 记</el-button>
                                <el-button @click="logInDialog = false">取 消</el-button>
                            </el-form-item>
                        </el-form>
                    </el-tab-pane>
                </el-tabs>
            </el-dialog>
            <!--修改名称-->
            <el-dialog
                    title="修改名称"
                    v-model="modifyUsernameDialog"
                    width="30%"
                    :before-close="handleClose"
                    align-center>
                <el-form ref="modifyUsernameForm" :model="modifyUsernameForm" label-width="80px">
                    <el-form-item label="账号">
                        <el-input v-model="modifyUsernameForm.account"></el-input>
                    </el-form-item>
                    <el-form-item label="密码">
                        <el-input type="password" v-model="modifyUsernameForm.password"></el-input>
                    </el-form-item>
                    <el-form-item label="新名称">
                        <el-input v-model="modifyUsernameForm.newUsername"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="ackModifyUsername">修改</el-button>
                        <el-button @click="modifyUsernameDialog = false">取消</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <!--修改密码-->
            <el-dialog
                    title="修改密码"
                    v-model="modifyPasswordDialog"
                    width="30%"
                    :before-close="handleClose"
                    align-center>
                <el-form ref="modifyPasswordForm" :model="modifyPasswordForm" label-width="80px">
                    <el-form-item label="旧密码">
                        <el-input type="password" v-model="modifyPasswordForm.oldPassword"></el-input>
                    </el-form-item>
                    <el-form-item label="新密码">
                        <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="modifyPasswordForm.newPassword1"></el-input>
                    </el-form-item>
                    <el-form-item label="确认密码">
                        <el-input type="password" placeholder="长度需要在6-20位之内，且须含有字母和数字" v-model="modifyPasswordForm.newPassword2"></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-button type="primary" @click="ackModifyPassword">修改</el-button>
                        <el-button @click="modifyPasswordDialog = false">取消</el-button>
                    </el-form-item>
                </el-form>
            </el-dialog>
            <!--消息中心-->
            <el-drawer
                    title="消息中心"
                    v-model="msgCenterDrawer"
                    direction="rtl">
                <div style="width:100%; height: 80%; overflow: auto">
                    <el-card style="margin: 2%" shadow="hover">
                        欢迎使用VQ0.8.1测试版
                        <!--分割线-->
                        <el-divider></el-divider>
                        本次更新：
                        <ol>
                            <li>更新动态和大厅UI及其交互。</li>
                            <li>修复发布动态按钮不显示的问题。</li>
                        </ol>
                    </el-card>
                </div>
            </el-drawer>

            <!--查看用户-->
            <el-dialog
                    title="用户信息"
                    v-model="userInformationDialog"
                    width="50%"
                    style="border-radius: 10px"
                    align-center>
                <table style="width: 100%;">
                    <tr>
                        <td style="width: 10%;" rowspan="2"><el-avatar src="/img/HeadSculpture.jpg" style="margin-top: auto; float: left;">{{trend.username}}</el-avatar></td>
                        <td style="float: left">{{this.hTrend.username}}</td>
                        <td style="float: right; color: red;">举 报</td>
                    </tr>
                    <tr>
                        <td style="float: left">{{this.hTrend.account}}</td>
                        <td style="float: right"><el-button key="primary" type="primary" @click="insertFriend(this.hTrend.account)" link>添 加</el-button></td>
                    </tr>
                </table>
            </el-dialog>
            <!--动态评论-->
            <el-dialog
                    title="评论"
                    v-model="critiqueDialog"
                    width="30%"
                    :before-close="handleClose"
                    align-center>
                <el-form ref="form" :model="form" label-width="80px">
                    <el-input
                            type="textarea"
                            placeholder="请输入内容"
                            v-model="critique.content"
                            clearable="true"
                            maxlength="1000"
                            autosize>
                    </el-input>
                </el-form>
                <div style="margin-top: 8%; margin-bottom: 14%" slot="footer" class="dialog-footer">
                    <el-button style="float: left" @click="critiqueDialog = false">取消</el-button>
                    <el-button style="float: right" type="primary" @click="critiqueTrends()">评论</el-button>
                </div>
            </el-dialog>
            <!--查看社区-->
            <el-dialog
                    title="社区信息"
                    v-model="communityInformationDialog"
                    width="50%"
                    style="border-radius: 10px"
                    align-center>
                <table style="width: 100%;">
                    <tr>
                        <td style="float: left">{{this.hCommunity.name}}</td>
                        <td style="float: right;"><el-button key="primary" type="primary" @click="open('/PC/community/index.html?name='+this.hCommunity.name)" link>查 看</el-button></td>
                    </tr>
                    <tr>
                        <td style="float: left">成员数：{{this.hCommunity.numberFollowers}}</td>
                        <td style="float: right"><el-button key="primary" type="primary" @click="addCommunityMember(this.hCommunity.id)" link>加 入</el-button></td>
                    </tr>
                </table>
            </el-dialog>
        </div>

        <script src="index.js"></script>
    </body>
</html>